<?php 
define("__ACTIVE_PAGE__", "broadcast");
require_once dirname(__FILE__).'/init.php'; 
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<?php require dirname(__FILE__).'/common/head.php'; ?>
	</head>
	<body>
		<?php require dirname(__FILE__).'/common/header.php'; ?>
		<div class="container">
			<div class="row">
				<div class="span12">
					<h4>Broadcast Messages</h4>
					<table class="table table-striped">
						<thead>
							<tr>
								<th>id</th>
								<th>Title</th>
								<th>Message</th>
								<th>Count</th>
								<th>Amount</th>
								<th>Remaining</th>
								<th></th>
							</tr>
						</thead>
						<tbody>
							<?php foreach ($company->messages as $message): ?>
								<tr <?php echo ($message->amount - $message->count < 1)? "class='error'": ""; ?>>
									<td><?php echo $message->id; ?></td>
									<td><?php echo $message->title; ?></td>
									<td><?php echo $message->text; ?></td>
									<td><?php echo $message->count; ?></td>
									<td><?php echo $message->amount; ?></td>
									<td><?php echo $message->amount - $message->count; ?></td>
									<td><a class="btn btn-small pull-right" href="message.php?id=<?php echo $message->id ?>">view</a></td>
								</tr>
							<?php endforeach; ?>
						</tbody>
					</table>
				</div>
			</div>
			<?php require dirname(__FILE__).'/common/footer.php'; ?>
		</div> 
	</body>
</html>

